package com.ygxsk.carhome.park;

import android.os.Bundle;
import android.view.View;

import com.blankj.utilcode.util.AppUtils;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.listener.DoubleClickListener;
import com.ygxsk.carhome.listener.ErrorParentExtraSingle;
import com.ygxsk.carhome.ui.ErrorActivity;

import org.greenrobot.eventbus.EventBus;

/*
 * @Author:itchenqi175@163.com
 * @Time:2024/1/5  15:17
 * @Description:车辆管理主页列表
 */
public class ParkingActivity extends ErrorActivity implements ErrorParentExtraSingle {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mActivityInstance = this;

        //AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

        //mSession = Session.get(this);

        initloading();

        initViews();

        processExtraData();

        //删除车牌监听
        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }

    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_parking;
    }

    @Override
    protected void initToolBar(ToolbarHelper toolbarHelper) {

//        toolbarHelper.setLayoutSao(false, null);
        toolbarHelper.setTitle("车辆管理");

        toolbarHelper.setVersionName(true, AppUtils.getAppVersionName());
        toolbarHelper.setLayoutLeft(true, R.drawable.backicon, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                methodBack();
            }
        });

        toolbarHelper.setLayoutClose(false, "", null);
//        toolbarHelper.setLayoutClose(false, "", null);

        //这里右侧是一个添加 按钮
        toolbarHelper.setLayoutRight(true, 1, "添加", new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (!DoubleClickListener.isFastDoubleClick()) {

                    Bundle bundle_extra = new Bundle();
//                    ActivityUtils.startActivity(bundle_extra, ParkingSelectSpaceActivity.class);

                }

            }
        });

    }

    @Override
    protected void onClickNodata(View v) {

        gainDatas();

    }

    @Override
    protected void initViews() {

    }

    @Override
    protected void gainDatas() {

    }

    @Override
    protected void methodBack() {

        methodBackFinish();

    }

    @Override
    public void processExtraData() {

        Bundle bundle = this.getIntent().getExtras();

        if (bundle != null) {
            //jumpFromFlag = bundle.getInt(ConstantApi.EXTRA_JUMPFROM_WHERE);
        }

        gainDatas();

    }
}